package cn.fl.customer.controller;

import java.io.File;
import java.io.FileInputStream;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;
import org.apache.poi.ss.usermodel.WorkbookFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

import cmm.comm.facade.upload.constant.SysUlFilesRecConstant;
import cmm.mid.core.framework.page.DataResultVO;
import cmm.mid.core.framework.page.KeyValueVO;
import cmm.mid.core.framework.page.ListPageVO;
import cmm.mid.core.framework.page.Pager;
import cmm.web.core.framework.controller.BaseController;
import cn.cmm.base.framework.constant.BaseConstant;
import cn.cmm.base.framework.exception.BaseException;
import cn.cmm.base.framework.utils.BaseLogUtils;
import cn.cmm.base.framework.utils.CollectionUtils;
import cn.cmm.base.framework.utils.DateUtils;
import cn.cmm.base.framework.utils.StringUtils;
import cn.cmm.cache.framework.utils.PropertiesCacheUtils;
import cn.fl.customer.service.IFilFinanceProService;
import cn.fl.customer.vo.FilFinanceProVO;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.system.constant.SysLogConstant;
import cn.fl.system.service.ISysDictionaryService;
import fl.customer.facade.customer.condition.FilFinanceProQueryCondition;
import fl.customer.facade.customer.constant.FilFinanceConstant;

/**
 * @Description: 资信财报---利润及利润分配表 控制层
 */
@Controller
@RequestMapping("/customer/filFinancePro")
public class FilFinanceProController extends BaseController {

	private static final Logger logger = LoggerFactory.getLogger(FilFinanceProController.class);

	/**
	 * FilFinancePro 服务层BEAN
	 */
	@Autowired
	private IFilFinanceProService filFinanceProService;

	@Autowired
	private ISysDictionaryService sysDictionaryService;

	/**
	 * 到利润及利润分配表页面
	 */
	@RequestMapping(value = "/toFilFinanceProPage.do", method = { RequestMethod.GET})
	public ModelAndView toFilFinanceProPage(HttpServletRequest request, HttpServletResponse response) {
		ModelAndView view = new ModelAndView("customer/filcreditfinance/filFinancePro");
		String cstId = request.getParameter("cstId");
		List<String> codeGrpCdList = new ArrayList<>();
		codeGrpCdList.add(FilFinanceConstant.CST_REPORT_TYPE_CD);//报表类型
		codeGrpCdList.add(FilFinanceConstant.CST_REPORT_SUB_TYPE_CD);//报表类型细分
		Map<String, List<KeyValueVO>> dicMap = this.sysDictionaryService.getMultiKvList(CurrentThreadContext.getFlServiceSysCd(), CurrentThreadContext.getCurrentOrgCd(), codeGrpCdList);
		view.addObject("reportTypeList", dicMap.get(FilFinanceConstant.CST_REPORT_TYPE_CD));// 报表类型
		view.addObject("reportsubTypeList", dicMap.get(FilFinanceConstant.CST_REPORT_SUB_TYPE_CD));// 报表类型细分
		view.addObject("cstId", cstId);
		BaseLogUtils.info(logger, "toFilFinanceProPage", "跳转到列表页面.", CurrentThreadContext.getCurrentUserName());
		return view;
	}
	/**
	 * 到利润及利润分配表查看页面
	 */
	@RequestMapping(value = "/toFilFinanceProDetailPage.do", method = { RequestMethod.GET})
	public ModelAndView toFilFinanceProDetailPage(HttpServletRequest request, HttpServletResponse response) {
		ModelAndView view = new ModelAndView("customer/filcreditfinance/filFinanceProDetail");
		String cstId = request.getParameter("cstId");
		List<String> codeGrpCdList = new ArrayList<>();
		codeGrpCdList.add(FilFinanceConstant.CST_REPORT_TYPE_CD);//报表类型
		codeGrpCdList.add(FilFinanceConstant.CST_REPORT_SUB_TYPE_CD);//报表类型细分
		Map<String, List<KeyValueVO>> dicMap = this.sysDictionaryService.getMultiKvList(CurrentThreadContext.getFlServiceSysCd(), CurrentThreadContext.getCurrentOrgCd(), codeGrpCdList);
		view.addObject("reportTypeList", dicMap.get(FilFinanceConstant.CST_REPORT_TYPE_CD));// 报表类型
		view.addObject("reportsubTypeList", dicMap.get(FilFinanceConstant.CST_REPORT_SUB_TYPE_CD));// 报表类型细分
		view.addObject("cstId", cstId);
		BaseLogUtils.info(logger, "toFilFinanceProDetailPage", "跳转到列表页面.", CurrentThreadContext.getCurrentUserName());
		return view;
	}
	/**
	 * 查询数据
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/selecProList.do", method = { RequestMethod.GET})
	@ResponseBody
	public DataResultVO selecProList(HttpServletRequest request, HttpServletResponse response) {
		String cstId = request.getParameter("cstId");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		if(StringUtils.isEmpty(cstId)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			return result;
		}
		FilFinanceProQueryCondition qc = new FilFinanceProQueryCondition();
		if (StringUtils.isNotEmpty(cstId)) {
			qc.setCstId(Long.valueOf(cstId));
			List<FilFinanceProVO> list = this.filFinanceProService.searchList(qc);
			result.setData(list);
		}else{
			result.setData(new ArrayList<FilFinanceProVO>());
		}
		BaseLogUtils.info(logger, "selectDebtList", "查询数据完成. DATA:" + JSONObject.toJSONString(result), CurrentThreadContext.getCurrentUserName());
		return result;
	}

	/**
	 * 新增
	 */
	@RequestMapping(value = "/addPro.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object addPro(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String cstId = request.getParameter("cstId");
		String formData = request.getParameter("formData");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		if(StringUtils.isEmpty(cstId)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.info(logger, "addPro", "新增数据,主键不存在.[cstId="+cstId+"]", CurrentThreadContext.getCurrentUserName());
			return result;
		}
		if(StringUtils.isEmpty(formData)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_PARAM_IS_BAD);
			BaseLogUtils.info(logger, "addPro", "新增数据,参数不完整.[cstId="+cstId+"]", CurrentThreadContext.getCurrentUserName());
			return result;
		}
		try {
			List<FilFinanceProVO> _list = JSON.parseArray(formData, FilFinanceProVO.class);
			if(CollectionUtils.isNotEmpty(_list)){
				FilFinanceProVO _deletevo = new FilFinanceProVO();
				_deletevo.setCstId(Long.valueOf(cstId));
				this.filFinanceProService.deleteByCstId(_deletevo);
				for (int i = 0; i < _list.size(); i++) {
					FilFinanceProVO _vo = _list.get(i);
					_vo.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
					_vo.setCrtTm(new Date());
					_vo.setIsDel(0);
					this.filFinanceProService.add(_vo);
				}
			}
			BaseLogUtils.info(logger, "addPro", "新增数据.[cstId="+cstId+"] DATA:" + formData, CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "addPro", "新增数据失败.DATA:" + formData + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "addPro", "新增数据失败.DATA:" + formData + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}

		return result;
	}

	/**
	 * 解析excel
	 */
	@RequestMapping(value = "/financeProXls.do", method = { RequestMethod.POST })
	@ResponseBody
	public DataResultVO financeProXls(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
		String filePath = request.getParameter("filePath");
		if(StringUtils.isEmpty(filePath)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("解析文件错误");
			BaseLogUtils.info(logger, "financeDebtXls", "操作数据,解析文件路径为空!", CurrentThreadContext.getCurrentUserName());
			return result;
		}
		try {
			//同时支持Excel 2003、2007
			File excelFile=new File(PropertiesCacheUtils.getProperty(SysUlFilesRecConstant.SYS_FILE_UPLOAD_ROOT_PATH)+filePath);//创建文件对象
			FileInputStream is = new FileInputStream(excelFile); //文件流
			Workbook workbook = WorkbookFactory.create(is); //这种方式 Excel 2003/2007/2010 都是可以处理的
			Sheet sheet = workbook.getSheetAt(0);
			int rowCount = sheet.getPhysicalNumberOfRows(); //获取总行数
			List<FilFinanceProVO> list = new ArrayList<FilFinanceProVO>();
			for (int r = 3; r < rowCount; r++) { // 从第四行开始
				FilFinanceProVO _vo = new FilFinanceProVO();
				Row row = sheet.getRow(r);
				for(int z=0;z<row.getLastCellNum();z++) {
					Cell cell = row.getCell(z);
					int cellType = cell.getCellType();
					String cellValue = "";
					switch (cellType) {
						case Cell.CELL_TYPE_NUMERIC: //数字、日期
							if (HSSFDateUtil.isCellDateFormatted(cell)) {
								//  如果是date类型则 ，获取该cell的date值
								cellValue = DateUtils.formatDateToString(HSSFDateUtil.getJavaDate(cell.getNumericCellValue()), DateUtils.YYYY_MM_DD);
							} else { // 纯数字
								double sss = cell.getNumericCellValue();
								DecimalFormat df = new DecimalFormat("#.##");
								cellValue = df.format(sss); //数字
							}
							break;
						case Cell.CELL_TYPE_STRING: //文本
							cellValue = cell.getStringCellValue();
							break;
						case Cell.CELL_TYPE_FORMULA: //函数
							double sss = cell.getNumericCellValue();
							DecimalFormat df = new DecimalFormat("#.##");
							cellValue = df.format(sss); //数字
							break;
						case Cell.CELL_TYPE_BLANK: //空白
							cellValue = cell.getStringCellValue();
							break;
						default:
							cellValue = "";
					}
					switch (z){
						case 0:
							_vo.setBelongDate(cellValue);//报表年份
							break;
						case 1:
							_vo.setReporttype(cellValue);//报表类型
							break;
						case 2:
							_vo.setReportsubtype(cellValue);//报表类型细分
							break;
						case 3:
							_vo.setAuditinstitute(cellValue);//审计事务所名称
							break;
						case 4:
							_vo.setAuditstaff(cellValue);//审计人员名称
							break;
						case 5:
							_vo.setAuditime(cellValue);//审计时间
							break;
						case 6:
							_vo.setMainIncome(cellValue);//营业收入
							break;
						case 7:
							_vo.setMainCost(cellValue);//营业成本
							break;
						case 8:
							_vo.setMainTaxes(cellValue);//营业税金及附加
							break;
						case 9:
							_vo.setMainOperCost(cellValue);//销售费用
							break;
						case 10:
							_vo.setMainManFee(cellValue);//管理费用
							break;
						case 11:
							_vo.setMainFinnaFee(cellValue);//财务费用
							break;
						case 12:
							_vo.setDevalueAssets(cellValue);//资产减值损失
							break;
						case 13:
							_vo.setFairProfit(cellValue);//公允价值变动净收益
							break;
						case 14:
							_vo.setInvestIncome(cellValue);//投资净收益
							break;
						case 15:
							_vo.setInvestVentures(cellValue);//对联营企业和合营企业的投资收益
							break;
						case 16:
							_vo.setOperProfit(cellValue);//营业利润
							break;
						case 17:
							_vo.setOperIncome(cellValue);//营业外收入
							break;
						case 18:
							_vo.setOperExpenditure(cellValue);//营业外支出
							break;
						case 19:
							_vo.setAssetsLoss(cellValue);//非流动资产损失
							break;
						case 20:
							_vo.setProfitTotal(cellValue);//利润总额
							break;
						case 21:
							_vo.setIncomeTax(cellValue);//所得税费用
							break;
						case 22:
							_vo.setProfitNet(cellValue);//净利润
							break;
						case 23:
							_vo.setEarnShare(cellValue);//基本每股收益
							break;
						case 24:
							_vo.setDilutEarnShare(cellValue);//稀释每股收益
							break;
					}
				}
				list.add(_vo);
			}
			result.setData(list);
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "financeProXls", "利润及利润分配表失败.ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("解析错误");
			BaseLogUtils.error(logger, "financeProXls", "利润及利润分配表失败,系统错误.ERROR:" + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}

		return result;
	}

	/**
	 * 到列表页面
	 */
	@RequestMapping(value = "/toListPage.do", method = { RequestMethod.GET})
	public ModelAndView toListPage(HttpServletRequest request, HttpServletResponse response) {
		ModelAndView view = new ModelAndView("customer/filFinancePro/list");
		BaseLogUtils.info(logger, "toListPage", "跳转到列表页面.", CurrentThreadContext.getCurrentUserName());
		return view;
	}

	/**
	 * 到修改页面
	 */
	@RequestMapping(value = "/toModifyPage.do", method = { RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toModifyPage(HttpServletRequest request, HttpServletResponse response) {
		String id = request.getParameter("id");
		ModelAndView view = new ModelAndView("customer/filFinancePro/modify");
		view.addObject("id", id);
		BaseLogUtils.info(logger, "toModifyPage", "跳转到修改页面.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
		return view;
	}

	/**
	 * 初始化列表
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/initList.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object initList(HttpServletRequest request, HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String searchName = request.getParameter("demo.name");
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}

		if (StringUtils.isNotEmpty(pageSize)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}

		FilFinanceProQueryCondition qc = new FilFinanceProQueryCondition();
		if (StringUtils.isNotEmpty(searchName)) {
			//TODO SOMTHING
		}
		page.setCondition(qc);
		
		//TODO SOMETHING
		Pager pager = new Pager();//this.filFinanceProService.searchListPage(page);
		List<FilFinanceProVO> list = (List<FilFinanceProVO>)pager.getResultList();
		ListPageVO<FilFinanceProVO> listPage = new ListPageVO<FilFinanceProVO>(list, pager.getTotalCount());
		BaseLogUtils.info(logger, "initList", "查询数据完成. DATA:" + JSONObject.toJSONString(page), CurrentThreadContext.getCurrentUserName());
		return listPage;
	}

	/**
	 * 删除数据
	 */
	@RequestMapping(value = "/removeById.do", method = {RequestMethod.POST })
	@ResponseBody
	public DataResultVO removeById(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_DELETE_SUCC);
		if(StringUtils.isEmpty(id)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			return result;
		}
		try {
			this.filFinanceProService.removeById(Long.valueOf(id));
			BaseLogUtils.info(logger, "removeById", "删除数据.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "removeById", "删除数据失败.[id="+id+"]"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "removeById", "删除数据失败.[id="+id+"]"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}

		return result;
	}

	/**
	 * 得到一条记录
	 * 
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getById.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object getById(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		if(StringUtils.isEmpty(id)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.error(logger, "getById", "获取数据,主键不存在.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
			return result;
		}
		
		try {
			FilFinanceProVO vo = this.filFinanceProService.selectById(Long.valueOf(id));
			if(null == vo){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_QUERY_DATA_IS_EMPTY);
				BaseLogUtils.info(logger, "getById", "获取数据,数据不存在.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
			}
			result.setData(vo);
			BaseLogUtils.info(logger, "getById", "获取数据.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
		}catch(BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "getById", "获取失败.[id="+id+"]"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch(Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "getById", "获取失败.[id="+id+"]"+ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}

	/**
	 * 新增
	 */
	@RequestMapping(value = "/add.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object add(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String name = request.getParameter("name");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_ADD_SUCC);
		FilFinanceProVO entity = null;
		try {
			entity = new FilFinanceProVO();
			//TODO ADD PARAM
			Long id = this.filFinanceProService.add(entity);
			result.setData(id);
			BaseLogUtils.info(logger, "add", "新增数据.[id="+id+"] DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "add", "新增数据失败.DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "add", "新增数据失败.DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}

		return result;
	}

	/**
	 * 修改
	 */
	@RequestMapping(value = "/modify.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object modify(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		String name = request.getParameter("name");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_UPDATE_SUCC);
		if(StringUtils.isEmpty(id)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			BaseLogUtils.info(logger, "modify", "修改数据,主键不存在.[id="+id+"]", CurrentThreadContext.getCurrentUserName());
			return result;
		}
		FilFinanceProVO entity = null;
		try {
			entity = new FilFinanceProVO();
			entity.setId(Long.valueOf(id));
			//entity.setName(name);
			//TODO ADD PARAM
			boolean success = this.filFinanceProService.modify(entity);
			if(!success){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
				BaseLogUtils.info(logger, "modify", "修改失败.[id="+id+"] DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
			}
			BaseLogUtils.info(logger, "modify", "修改成功.[id="+id+"] DATA:" + JSONObject.toJSONString(entity), CurrentThreadContext.getCurrentUserName());
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			BaseLogUtils.info(logger, "modify", "修改失败.[id="+id+"] DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			BaseLogUtils.error(logger, "modify", "修改失败.[id="+id+"] DATA:" + JSONObject.toJSONString(entity) + ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}
}

